﻿using CarAppDto.Base;
using CarAppDto.Rule.RuleMappingDtos;
using FluentValidation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CarAppDto.Rule.RuleConfigDtos
{
    public class RuleMappingDetailsValidator : AbstractValidator<RuleMappingDetails>
    {
        /// <summary>
        /// 校验规则写到校验类的构造方法中
        /// </summary>
        public RuleMappingDetailsValidator()
        {
            RuleFor(x => x.Type).NotEmpty();
                  }
    }
    /// <summary>
    /// 规则详情
    /// </summary>
    public class RuleMappingDetails: BaseModelInfo
    {
        /// <summary>
        /// 详情类型
        /// </summary>
      public MappingDetailsType Type { get; set; }

      public List<ValueDetails>? ValueDetailsList { get; set; } = null;

      public ReferenceDetails? ReferenceDetails { get; set; } = null;

    }

    /// <summary>
    /// 值类型
    /// </summary>
    public class ValueDetails
    { 
  
        public string Key { get; set; }
        public string Value { get; set; }
        public int Index { get; set; }
    }
    /// <summary>
    /// 引用类型
    /// </summary>

    public class ReferenceDetails
    {
        /// <summary>
        /// 展示字段名
        /// </summary>
         public string Key { get; set; }
        /// <summary>
        /// 展示值
        /// </summary>
        public string Value { get; set; }

        /// <summary>
        /// 主键id
        /// </summary>
        public string Id { get; set; }
    }

    /// <summary>
    /// 主键和值匹配
    /// </summary>
    public class RuleMappingValue
    {
        public string? Key { get; set; }
        public string? Value { get; set; }
    }

    public class MappingDetails
    {
        public string Key { get; set; }
        public string Value { get; set; }

        /// <summary>
        /// 主键id
        /// </summary>
        public string Id { get; set; }

        /// <summary>
        /// 是否选中
        /// </summary>
        public bool IsSelected { get; set; } = false;
    }
}
